package com.zhu.gmallpublisher.mapper;

import com.zhu.gmallpublisher.bean.CouponReduceStats;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 优惠券主题
 */
public interface CouponStatsMapper {


    @Select("select sum(order_coupon_reduce_amount) as coupon_reduce_amount," +
            "sum(order_origin_total_amount) as order_total_amount," +
            "round( round(toFloat64(coupon_reduce_amount),5) / round(toFloat64(coupon_total_amount),5) ,20) as coupon_subsidy_rate " +
            "where toYYYYMMDD(stt) = #{date} group by toYYYYMMDD(stt)")
    List<CouponReduceStats> selectCouponStats(@Param("date") Integer date);
}
